package com.xiaoge.listener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.PayloadApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @author <a href="mailto:1330137071@qq.com">Zhang Xiao</a>
 * @since
 */
@Component
public class ZhangXiaoApplicationAnnotationListener {

	/**
	 * 事件监听器, 注解版
	 * @param event
	 */
	@EventListener
	public void a(ApplicationEvent event) {
		if (event instanceof PayloadApplicationEvent) {
			PayloadApplicationEvent e = (PayloadApplicationEvent) event;
			System.out.println(e.getPayload());
 		}
		System.out.println(event);
	}

}
